PROJECT(gluxi)

CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)

SET(CMAKE_COLOR_MAKEFILE ON)
SET(CMAKE_USE_RELATIVE_PATHS OFF)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
OPTION(DEBUG "Generate debug info" OFF)

SET (LIB_SEARCH
	/usr/lib
	/usr/local/lib
)

SET (INC_SEARCH
	/usr/include
	/usr/local/include
)


# Find Qt4
SET (QT_USE_QTGUI TRUE)
SET (QT_USE_QTSQL TRUE)
SET (QT_USE_QTNETWORK TRUE)
FIND_PACKAGE(Qt4 REQUIRED)
FIND_PACKAGE(OpenSSL REQUIRED)
FIND_PACKAGE(Threads REQUIRED)

INCLUDE(${QT_USE_FILE})

# Find libgloox library
FIND_LIBRARY(LIBGLOOX_LIB NAMES gloox PATHS ${LIB_SEARCH})
FIND_PATH(LIBGLOOX_INC gloox/gloox.h ${INC_SEARCH})

INCLUDE_DIRECTORIES(
	${INCLUDE_DIRECTORIES}
	${OPENSSL_INCLUDE_DIR}
	${QT_INCLUDE_DIR}
	${QT_QTSQL_INCLUDE_DIR}
	${LIBGLOOX_INC}
)

IF (DEBUG)
	SET(CMAKE_BUILD_TYPE debug)
ENDIF(DEBUG)

SET (HG_VERSION_FILE
    ${CMAKE_CURRENT_BINARY_DIR}/gluxi_version.c
)

SET (HG_VERSION_DEPENDS
	${CMAKE_SOURCE_DIR}/.hg/dirstate
)

SET (HG_VERSION_GENERATOR
	${CMAKE_SOURCE_DIR}/cmake/hgversion.sh
)

ADD_SUBDIRECTORY(src)

